<%@ page contentType="text/html;charset=UTF-8" language="java"
	isELIgnored="false" import="com.teichmann.core.targets.online.*"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<head>
<link rel="shortcut icon" href="img/favicon.ico">
<META NAME="description"
	CONTENT="Ache meu carro O melhor e maior buscador de veiculos do RS">
<meta name="keywords"
	content="buscador, veiculos, novos, usados, antigos, RS" />
<meta name="google-site-verification" content="qhrbhHgJcPMh-iibZKUL3xSRVeOPC7xXrXkXkY5wQ9I" />
<link type="text/css" rel="stylesheet" href="css/style.css">
<link type="text/css" rel="stylesheet" href="css/screen.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>

<script type="text/javascript">
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-16578163-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

  $(function(){
		$("#buscar").click(function(){
			if ($.trim($("#modelo").val()) != ''){
		        $("#buscar").remove();
		        $("#load").append('<img id="buscar" src="img/loading.gif">');

		        if ($('#error')){
		        	$('#error').hide();
		        }

		        var data = { 'origem' : [], 'modelo' : [],'jsessionid':[]};
		        $(":checked").each(function() {
		          data['origem'].push($(this).val()); 
		        });
		        data['modelo'].push($('#modelo').val());
		        data['jsessionid'].push($('#jsessionid').val());
		        
		        jQuery.ajax({
	                type: "POST",
	                url: "search?id="+data['jsessionid'],
	                dataType:"html",
	                data: data,
	                success:function(response){      
			           location.href ='listResults.jsp?id='+data['jsessionid'];   
	                },
	                error:function (xhr, ajaxOptions, thrownError){
	        	        $('#error').show();
	        	        $("#buscar").empty().html('<input id="buscar" name="enviar" type="submit" value="Buscar">');
	        	        $("#loading").hide();
	                }    
	      	 });
	     
		        
		      	 
	      	 }
	    });
	});

	$(function(){
		var all = false;
		$("#all").click( function(){
			all = !all;
			$("input[name=origem]").each(function(){
				this.checked = all;
			});
	    });
	}); 
  
</script>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>AcheMeuCarro.com.br - A melhor busca de automóveis do RS</title>
</head>


<body>
<jsp:include page="menu.jsp"/>
<br/>
<div align="center"><img class="displayCenter" src="img/logo.jpg"></div>
<br>
<div align="center">
<div id="load" name="load">
<input type="text" id="modelo" name="modelo" value="" size="15"> 
<input id="buscar" name="enviar" type="submit" value="Buscar">

<input type="hidden" id="jsessionid" name="jsessionid" value="<c:out value="${pageContext.session.id}"/>"></input>

</div>

<div id="outer">&nbsp;<img id="all" src="img/all.gif" alt="Todos"
	title="Todos" /> &nbsp; <label> Buscadores</label> <br>
<span> <input type="checkbox" name="origem" id="origem"
	value="<%=AutoCarro.class.getSimpleName()%>"> Auto Carro <img id="all" src="img/info-icon.png"   style="padding-bottom: 2px; vertical-align: middle;"  alt="Região Metropolitana" title="Região Metropolitana" />
<br>
<input type="checkbox" name="origem" id="origem"
	value="<%=AutoCentro.class.getSimpleName()%>"> Auto Centro <img id="all" src="img/info-icon.png" style="padding-bottom: 2px; vertical-align: middle;" alt="Vale do Taquari" title="Vale do Taquari" />
<br>
<input type="checkbox" name="origem" id="origem"
	value="<%=SulRevendas.class.getSimpleName()%>"> Sul Revendas <img id="all" src="img/info-icon.png" style="padding-bottom: 2px; vertical-align: middle;" alt="Região central" title="Região Central" />
<br>
<input type="checkbox" name="origem" id="origem"
	value="<%=CarroNaSerra.class.getSimpleName()%>"> Carros na Serra <img id="all" src="img/info-icon.png" style="padding-bottom: 2px; vertical-align: middle;" alt="Serra gaúcha" title="Serra gaúcha" />
<br>
<input type="checkbox" name="origem" id="origem"
	value="<%=MeuCarroNovo.class.getSimpleName()%>"> Meu Carro Novo <img id="all" src="img/info-icon.png" style="padding-bottom: 2px; vertical-align: middle;" alt="Centro e Região Metropolitana" title="Centro e Região Metropolitana" />
</span></div>

</div>

<c:if test="${param.notFound == 1}">
	<div align="center">
	<div id="error" class="error"
		style="width: 400px; position: relative; top: 90px;">Não
	encontramos seu veiculo. Realize uma nova consulta</div>
	</div>
</c:if>


</body>
</html>
